﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Windows.Input;
using Douban.Api.User;
using Douban.Core;
using Douban.Modules.Friends.Views;
using Microsoft.Practices.Composite.Presentation.Commands;
using System.Windows.Media;

namespace Douban.Modules.Friends.ViewModels
{
    public class ContactListViewModel : ObservableObject, IContactListViewModel
    {
        private ObservableCollection<ContactListItemViewModel> _contacts;
        private int _selectedContactIndex;

        public ContactListViewModel(IContactListView view)
        {
            View = view;
            View.Context = this;
            _selectedContactIndex = -1;
        }

        public IContactListView View { get; set; }

        public ObservableCollection<ContactListItemViewModel> Contacts
        {
            get
            {
                return _contacts;
            }
            set
            {
                if (_contacts == value) return;

                _contacts = value;
                NotifyPropertyChanged("Contacts");
            }
        }

        public int SelectedContactIndex
        {
            get { return _selectedContactIndex; }
            set
            {
                if(_selectedContactIndex == value) return;

                _selectedContactIndex = value;
                NotifyPropertyChanged("SelectedContactIndex");
            }
        }
    }
}
